home *** CD-ROM | disk | FTP | other *** search
- diff -u --new-file ../qmail-1.01-unmodified/Makefile ./Makefile
- --- ../qmail-1.01-unmodified/Makefile Tue Apr 15 07:05:23 1997
- +++ ./Makefile Thu Oct 2 10:30:27 1997
- @@ -495,6 +491,9 @@
- cat auto-ccld.sh find-systype.sh > find-systype
- chmod 755 find-systype
-
- +flock.o: compile flock.c
- + ./compile flock.c
- +
- fmt_str.o: \
- compile fmt_str.c fmt.h fmt_str.c
- ./compile fmt_str.c
- @@ -577,8 +576,8 @@
- ./compile gfrom.c
-
- hasflock.h: \
- -tryflock.c compile load
- - ( ( ./compile tryflock.c && ./load tryflock ) >/dev/null \
- +tryflock.c compile load flock.o
- + ( ( ./compile tryflock.c && ./load tryflock flock.o ) >/dev/null \
- 2>&1 \
- && echo \#define HASFLOCK 1 || exit 0 ) > hasflock.h
- rm -f tryflock.o tryflock
- @@ -729,8 +728,8 @@
- chmod 755 load
-
- lock.a: \
- -makelib lock_ex.o lock_exnb.o lock_un.o
- - ./makelib lock.a lock_ex.o lock_exnb.o lock_un.o
- +makelib lock_ex.o lock_exnb.o lock_un.o flock.o
- + ./makelib lock.a lock_ex.o lock_exnb.o lock_un.o flock.o
-
- lock_ex.o: \
- compile lock_ex.c lock_ex.c lock_ex.c lock_ex.c hasflock.h lock_ex.c \
- @@ -1826,6 +1825,7 @@
- ip.h ip.c ipalloc.h ipalloc.c select.h1 select.h2 trysysel.c ndelay.h \
- ndelay.c ndelay_off.c direntry.3 direntry.h1 direntry.h2 trydrent.c \
- prot.h prot.c chkshsgr.c warn-shsgr tryshsgr.c ipme.h ipme.c \
- +flock.c \
- trysalen.c maildir.5 maildir.h maildir.c tcp-environ.5
- shar -m `cat FILES` > shar
- chmod 400 shar
- diff -u --new-file ../qmail-1.01-unmodified/TARGETS ./TARGETS
- --- ../qmail-1.01-unmodified/TARGETS Tue Apr 15 07:05:23 1997
- +++ ./TARGETS Thu Oct 2 10:32:09 1997
- @@ -351,3 +350,4 @@
- envelopes.0
- forgeries.0
- man
- +flock.o
- diff -u --new-file ../qmail-1.01-unmodified/conf-cc ./conf-cc
- --- ../qmail-1.01-unmodified/conf-cc Tue Apr 15 07:05:23 1997
- +++ ./conf-cc Fri Sep 26 00:25:43 1997
- @@ -1,3 +1,3 @@
- -cc -O2
- +gcc -O2 -fomit-frame-pointer -resident -Wall -Dfork=vfork
-
- This will be used to compile .c files.
- diff -u --new-file ../qmail-1.01-unmodified/conf-ld ./conf-ld
- --- ../qmail-1.01-unmodified/conf-ld Tue Apr 15 07:05:23 1997
- +++ ./conf-ld Wed Sep 10 12:45:27 1997
- @@ -1,3 +1,3 @@
- -cc -s
- +gcc -s -resident
-
- This will be used to link .o files into an executable.
- diff -u --new-file ../qmail-1.01-unmodified/conf-qmail ./conf-qmail
- --- ../qmail-1.01-unmodified/conf-qmail Tue Apr 15 07:05:23 1997
- +++ ./conf-qmail Mon Sep 29 15:30:31 1997
- @@ -1,4 +1,4 @@
- -/var/qmail
- +qmail
-
- This is the qmail home directory. It must be a local directory, not
- shared among machines. This is where qmail queues all mail messages.
- diff -u --new-file ../qmail-1.01-unmodified/find-systype.sh ./find-systype.sh
- --- ../qmail-1.01-unmodified/find-systype.sh Tue Apr 15 07:05:23 1997
- +++ ./find-systype.sh Wed Sep 10 12:45:29 1997
- @@ -85,6 +85,14 @@
- chip="$unamem"
- kern=""
- ;;
- + amigaos)
- + oper="$sys-$unamer-$unamev"
- + arch="$unamem"
- + syst=""
- + # uname -p prints "unknown" :-(
- + chip="`CPU | sed -e 's/System: //' -e 's/ (.*//' -e 's/ /+/'`"
- + kern=""
- + ;;
- *)
- oper="$sys-$unamer-$unamev"
- arch="`arch | tr /: ..`"
- diff -u --new-file ../qmail-1.01-unmodified/flock.c ./flock.c
- --- ../qmail-1.01-unmodified/flock.c Thu Jan 1 01:00:00 1970
- +++ ./flock.c Wed Sep 10 22:35:52 1997
- @@ -0,0 +1,278 @@
- +/* flock.c : flock() and amiga_flock()
- +
- + * flock()
- +
- + * Attempts to emulate flock().
- + * Lock files (filename.lock) are used for this.
- + * open() does not support bloking behaviour, so if non-blocking behaviour
- + * is not requested, an attempt will be made every second until locking
- + * is successful.
- + * ChangeMode() does not support blocking behaviour, so if non-blocking
- + * behaviour is not requested, an attempt will be made every second until
- + * locking is successful.
- + */
- +
- +#define _KERNEL
- +#define _INTERNAL_FILE
- +
- +#include <dos/dos.h>
- +#include <dos/dosextens.h>
- +
- +#include <stdlib.h>
- +#include <unistd.h>
- +#include <sys/file.h>
- +#include <errno.h>
- +
- +#include <proto/dos.h>
- +
- +static fd_set locked;
- +static fd_set shared;
- +static int lock_fd [FD_SETSIZE];
- +
- +int amiga_flock(int fd, int flags);
- +static int create_lock (int fd, BOOL exclusive, BOOL blocking);
- +static int create_lock_file (char *lockname, BOOL exclusive);
- +
- +int flock (int fd, int flags)
- +{
- + /* Create a new shared lock or turn an existing exclusive lock into
- + * a shared one.
- + */
- + if (flags & LOCK_SH)
- + {
- + /* Change existing shared lock. */
- + if (FD_ISSET (fd, &locked))
- + {
- + if (FD_ISSET (fd, &shared))
- + return 0;
- + else
- + {
- + if (-1 != amiga_flock (lock_fd [fd], ((flags & LOCK_NB) | LOCK_SH)))
- + {
- + FD_SET (fd, &shared);
- + return (0);
- + }
- + else
- + return (-1);
- + }
- + }
- + /* Create new shared lock. */
- + else
- + {
- + if (-1 != (lock_fd [fd] = create_lock (fd, FALSE, !(flags & LOCK_NB))))
- + {
- + FD_SET (fd, &locked);
- + FD_SET (fd, &shared);
- + return (0);
- + }
- + else
- + return (-1);
- + }
- + }
- +
- + /* Create a new exclusive lock or turn an existing shared lock into
- + * an exclusive one.
- + */
- + if (flags & LOCK_EX)
- + {
- + /* Change existing shared lock. */
- + if (FD_ISSET (fd, &locked))
- + {
- + if (! FD_ISSET (fd, &shared))
- + return 0;
- + else
- + {
- + if (-1 != amiga_flock (lock_fd [fd], ((flags & LOCK_NB) | LOCK_EX)))
- + {
- + FD_CLR (fd, &shared);
- + return (0);
- + }
- + else
- + return (-1);
- + }
- + }
- + /* Create new exclusive lock. */
- + else
- + {
- + if (-1 != (lock_fd [fd] = create_lock (fd, TRUE, !(flags & LOCK_NB))))
- + {
- + FD_SET (fd, &locked);
- + FD_CLR (fd, &shared);
- + return (0);
- + }
- + else
- + return (-1);
- + }
- + }
- +
- + /* Release an existing lock. */
- + if (flags & LOCK_UN)
- + {
- + if (FD_ISSET (fd, &locked))
- + {
- + close (lock_fd [fd]);
- + FD_CLR (fd, &locked);
- + }
- + return (0);
- + }
- +
- + /* No valid flags specified? */
- + errno = EINVAL;
- + return (-1);
- +}
- +
- +static int create_lock (int fd, BOOL exclusive, BOOL blocking)
- +{
- + struct file *fp;
- + char *lockname;
- + int lock_fd;
- +
- + fp = (struct file *) fcntl (fd, F_EXTERNALIZE, 0);
- + if (fp == (struct file *) -1 || fp == NULL)
- + return (-1);
- +
- + if (! (( lockname = malloc (strlen (fp->f_name) + 6) )) )
- + {
- + errno = ENOMEM;
- + return (-1);
- + }
- +
- + strcpy (lockname, fp->f_name);
- + strcat (lockname, ".lock");
- + errno = 0;
- +
- + lock_fd = create_lock_file (lockname, exclusive);
- +
- + /* If the lock failed: exit with error if non-blocking, or keep
- + * retrying until success (or unrelated failure) if blocking.
- + */
- + while (errno == EWOULDBLOCK && blocking)
- + {
- + errno = 0;
- + sleep (1);
- + lock_fd = create_lock_file (lockname, exclusive);
- + }
- +
- + return (lock_fd);
- +}
- +
- +static int create_lock_file (char *lockname, BOOL exclusive)
- +{
- + struct file *lockfile;
- + int temp_errno;
- + int lock_fd;
- +
- + /* Attempt to open the lock file. To avoid deadlock (multiple tasks
- + * managing to open() before at least one amiga_lock()s) on exclusive
- + * locks, add O_EXCL when exclusive mode is requested.
- + */
- + if (-1 == (lock_fd = open (lockname, O_CREAT /* | (exclusive ? O_EXCL : 0) */ )))
- + {
- + if (errno == EEXIST)
- + errno = EWOULDBLOCK;
- + return (-1);
- + }
- +
- + /* The lock file should be deleted when it is closed. */
- + lockfile = (struct file *) fcntl (lock_fd, F_EXTERNALIZE);
- + if (lockfile == (struct file *) -1 || lockfile == NULL)
- + {
- + temp_errno = errno;
- + close (lock_fd);
- + errno = temp_errno;
- + return (-1);
- + }
- + lockfile->f_flags |= FUNLINK;
- +
- + /* Change file handle to exclusive mode if requested. */
- + if (exclusive && !errno)
- + {
- + if (-1 == (amiga_flock (lock_fd, LOCK_EX | LOCK_NB)))
- + {
- + temp_errno = errno;
- + close (lock_fd);
- + errno = temp_errno;
- + return (-1);
- + }
- + }
- + return (lock_fd);
- +}
- +
- +/* amiga_flock()
- +
- + * Similar to flock(), but uses mandatory Amiga file locks instead of
- + * advisory locks.
- + * Note that because of this, there will always be at least a shared lock
- + * on the file with this implementation.
- + * ChangeMode() does not support blocking behaviour, so if non-blocking
- + * behaviour is not requested, an attempt will be made every second until
- + * locking is successful.
- + */
- +
- +/*
- +#define DEBUG_VERSION
- +#include <kprintf.h>
- +
- +char __flock_errorbuf[256];
- +char __flock_fnamebuf[1024];
- +char __flock_tnamebuf[1024];
- +*/
- +
- +/* FIXME ix_amiga.h doesn't declare this function. */
- +/* #include <ix_amiga.h> */
- +BPTR __amiga_filehandle (int fd);
- +
- +int amiga_flock (int fd, int flags)
- +{
- + BPTR filehandle;
- +
- + /* FIXME __amiga_filehandle() doesn't always set errno on failure :-( */
- + errno = 0;
- +
- + /* Get the filehandle (if any) associated with the file descriptor */
- + if ((filehandle = __amiga_filehandle (fd)))
- + {
- + ULONG newmode;
- + BOOL success;
- +
- + if ((flags & LOCK_SH) || (flags & LOCK_UN))
- + newmode = SHARED_LOCK;
- + else if (flags & LOCK_EX)
- + newmode = EXCLUSIVE_LOCK;
- + else
- + return (0);
- +
- + if (flags & LOCK_NB)
- + {
- + if ((success = ChangeMode (CHANGE_FH, filehandle, newmode)))
- + return (0);
- + else
- + {
- + errno = EWOULDBLOCK;
- +/*
- + Fault (IoErr(), NULL, __flock_errorbuf, 256);
- + NameFromFH (filehandle, __flock_fnamebuf, 1024);
- + GetProgramName (__flock_tnamebuf, 1024);
- + KPrintF ("%s: ChangeMode (%s,%ld) failure: %s\n",
- + __flock_tnamebuf, __flock_fnamebuf , newmode,
- + __flock_errorbuf);
- +*/
- + return (-1);
- + }
- + }
- + else
- + /* Blocking behaviour - loop (with delay) until success. */
- + {
- + while (! ChangeMode (CHANGE_FH, filehandle, newmode))
- + sleep (1);
- + return (0);
- + }
- + }
- + /* Getting the file handle failed. */
- + else
- + {
- + if (errno != EBADF)
- + errno = EINVAL;
- + return (-1);
- + }
- +}
- diff -u --new-file ../qmail-1.01-unmodified/install.c ./install.c
- --- ../qmail-1.01-unmodified/install.c Tue Apr 15 07:05:23 1997
- +++ ./install.c Wed Sep 10 12:45:33 1997
- @@ -95,10 +95,12 @@
- break;
-
- case 'p':
- +#ifndef __amigaos__
- if (fifo_make(target.s,0700) == -1)
- if (errno != error_exist)
- strerr_die4sys(111,FATAL,"unable to mkfifo ",target.s,": ");
- break;
- +#endif
-
- case 'd':
- if (mkdir(target.s,0700) == -1)
- diff -u --new-file ../qmail-1.01-unmodified/qmail-local.c ./qmail-local.c
- --- ../qmail-1.01-unmodified/qmail-local.c Tue Apr 15 07:05:23 1997
- +++ ./qmail-local.c Thu Sep 25 22:10:10 1997
- @@ -28,6 +28,11 @@
- #include "gfrom.h"
- #include "auto_patrn.h"
-
- +#ifdef __amigaos__
- +#include <sys/file.h>
- +#include <string.h>
- +#endif
- +
- void err(s) char *s; { substdio_putsflush(subfderr,s); }
- void soft() { _exit(111); }
- void hard() { _exit(100); }
- @@ -44,12 +49,12 @@
- void temp_open(fn) char *fn; { err("Unable to open "); err(fn); err(". (#4.2.1)\n"); soft(); }
-
- void temp_blankline() { err("Uh-oh: first line of .qmail file is blank. (#4.2.1)\n"); soft(); }
- -void temp_fofile() { err("Uh-oh: .qmail has file delivery but has x bit set. (#4.7.0)\n"); soft(); }
- -void temp_foprog() { err("Uh-oh: .qmail has prog delivery but has x bit set. (#4.7.0)\n"); soft(); }
- +void temp_fofile() { err("Uh-oh: .qmail has file delivery but has e bit set. (#4.7.0)\n"); soft(); }
- +void temp_foprog() { err("Uh-oh: .qmail has prog delivery but has e bit set. (#4.7.0)\n"); soft(); }
- void temp_nomem() { err("Out of memory. (#4.3.0)\n"); soft(); }
- void temp_chdir() { err("Unable to switch to home directory. (#4.3.0)\n"); soft(); }
- void temp_homestat() { err("Unable to stat home directory. (#4.3.0)\n"); soft(); }
- -void temp_homesticky() { err("Home directory is sticky: user is editing his .qmail file. (#4.2.1)\n"); soft(); }
- +void temp_homesticky() { err("Home directory has h bit set: user is editing his .qmail file. (#4.2.1)\n"); soft(); }
- void temp_homewritable() { err("Uh-oh: home directory is writable. (#4.7.0)\n"); soft(); }
- void temp_qmwritable() { err("Uh-oh: .qmail file is writable. (#4.7.0)\n"); soft(); }
- void temp_nfsqmail() { err("Temporary error trying to open .qmail file. (#4.3.0)\n"); soft(); }
- @@ -61,7 +66,7 @@
- void bounce_ext() { err("Sorry, no mailbox here by that name. (#5.1.1)\n"); hard(); }
- void usage() { err("qmail-local: usage: qmail-local [ -nN ] user homedir local dash ext domain sender aliasempty\n"); hard(); }
-
- -void warn_homesticky() { err("Warning: home directory is sticky.\n"); }
- +void warn_homesticky() { err("Warning: home directory has h bit set.\n"); }
-
- int flagdoit;
- int flag99;
- @@ -202,6 +207,7 @@
-
- if (seek_begin(0) == -1) temp_rewind();
-
- +#ifndef __amigaos__
- fd = open_append(fn);
- if (fd == -1) temp_open(fn);
-
- @@ -211,6 +217,27 @@
- alarm(0);
- sig_alarmdefault();
-
- +#else /* __amigaos__ */
- + /* Attempt a mandatory exclusive lock for upto 30 seconds. */
- + {
- + int c;
- +
- + for (c = 30, flaglocked = 0; !flaglocked && c >= 0; c--)
- + {
- + if (-1 != (fd = open_append(fn)))
- + {
- + if (!(flaglocked = (-1 != amiga_flock (fd, LOCK_EX | LOCK_NB))))
- + {
- + close (fd);
- + if (c != 0) sleep (1);
- + }
- + }
- + }
- + if (!flaglocked)
- + temp_slowlock();
- + }
- +#endif /* __amigaos__ */
- +
- seek_end(fd);
- pos = seek_cur(fd);
-
- @@ -476,7 +503,11 @@
- if (!(aliasempty = *argv++)) usage();
- if (*argv) usage();
-
- +#ifdef __amigaos__
- + if (strchr (homedir, ':') <= &homedir[0]) usage();
- +#else
- if (homedir[0] != '/') usage();
- +#endif
- if (chdir(homedir) == -1) temp_chdir();
- checkhome();
-
- @@ -545,8 +576,13 @@
- if (!stralloc_copys(&dashext,dash)) temp_nomem();
- if (!stralloc_cats(&dashext,ext)) temp_nomem();
- for (i = 0;i < dashext.len;++i)
- +#ifdef __amigaos__
- + if (dashext.s[i] == '.' || dashext.s[i] == ':' || dashext.s[i] == '/')
- + dashext.s[i] = ';';
- +#else
- if (dashext.s[i] == '.')
- dashext.s[i] = ':';
- +#endif
- case_lowerb(dashext.s,dashext.len);
-
- extx = ext;
- @@ -602,8 +638,8 @@
- for (j = 0;j < cmds.len;++j)
- if (cmds.s[j] == '\n')
- {
- - switch(cmds.s[i]) { case '#': case '.': case '/': case '|': break;
- - default: ++numforward; }
- + switch(cmds.s[i]) { case '&': ++numforward; break;
- + default: break; }
- i = j + 1;
- }
-
- @@ -628,17 +664,6 @@
- temp_blankline();
- case '#':
- break;
- - case '.':
- - case '/':
- - ++count_file;
- - if (flagforwardonly) temp_fofile();
- - if (cmds.s[k - 1] == '/')
- - if (flagdoit) maildir(cmds.s + i);
- - else sayit("maildir ",cmds.s + i,k - i);
- - else
- - if (flagdoit) mailfile(cmds.s + i);
- - else sayit("mbox ",cmds.s + i,k - i);
- - break;
- case '|':
- ++count_program;
- if (flagforwardonly) temp_foprog();
- @@ -651,11 +676,21 @@
- break;
- case '&':
- ++i;
- - default:
- ++count_forward;
- if (flagdoit) recips[numforward++] = cmds.s + i;
- else sayit("forward ",cmds.s + i,k - i);
- break;
- + default:
- + ++count_file;
- + if (flagforwardonly) temp_fofile();
- + if (cmds.s[k - 1] == '/')
- + if (flagdoit) maildir(cmds.s + i);
- + else sayit("maildir ",cmds.s + i,k - i);
- + else
- + if (flagdoit) mailfile(cmds.s + i);
- + else sayit("mbox ",cmds.s + i,k - i);
- + break;
- +
- }
- i = j + 1;
- if (flag99) break;
- --- ../qmail-1.01-unmodified/qmail-newu.c Tue Apr 15 07:05:23 1997
- +++ qmail-newu.c Sun Oct 5 16:14:54 1997
- @@ -94,7 +94,7 @@
- if (!match) die_format();
-
- if (byte_chr(line.s,line.len,'\0') < line.len) die_format();
- - i = byte_chr(line.s,line.len,':');
- + i = byte_chr(line.s,line.len,'|');
- if (i == line.len) die_format();
- if (i == 0) die_format();
- if (!stralloc_copys(&key,"!")) die_nomem();
- @@ -115,7 +115,7 @@
-
- numcolons = 0;
- for (i = 0;i < data.len;++i)
- - if (data.s[i] == ':') {
- + if (data.s[i] == '|') {
- data.s[i] = 0;
- if (++numcolons == 6)
- break;
- --- ../qmail-1.01-unmodified/qmail-pw2u.9 Tue Apr 15 07:05:23 1997
- +++ qmail-pw2u.9 Sun Oct 5 22:33:21 1997
- @@ -20,7 +20,7 @@
- Each line has the format
-
- .EX
- - user:password:uid:gid:gecos:home:shell
- + user|password|uid|gid|gecos|home|shell
- .EE
-
- where
- @@ -121,7 +121,7 @@
- Each line has the form
-
- .EX
- - user:mailname1:mailname2:...
- + user|mailname1|mailname2|...
- .EE
-
- The addresses
- @@ -155,7 +155,7 @@
- Each line has the form
-
- .EX
- - sub:user:pre:
- + sub|user|pre:
- .EE
-
- .I sub
- --- ../qmail-1.01-unmodified/qmail-pw2u.c Tue Apr 15 07:05:23 1997
- +++ qmail-pw2u.c Sun Oct 5 16:15:25 1997
- @@ -99,19 +99,19 @@
-
- if (byte_chr(line.s,line.len,'\0') < line.len) return;
-
- - x = line.s; xlen = line.len; i = byte_chr(x,xlen,':'); if (i == xlen) return;
- + x = line.s; xlen = line.len; i = byte_chr(x,xlen,'|'); if (i == xlen) return;
- if (!stralloc_copyb(&user,x,i)) die_nomem();
- if (!stralloc_0(&user)) die_nomem();
- - ++i; x += i; xlen -= i; i = byte_chr(x,xlen,':'); if (i == xlen) return;
- - ++i; x += i; xlen -= i; i = byte_chr(x,xlen,':'); if (i == xlen) return;
- + ++i; x += i; xlen -= i; i = byte_chr(x,xlen,'|'); if (i == xlen) return;
- + ++i; x += i; xlen -= i; i = byte_chr(x,xlen,'|'); if (i == xlen) return;
- if (!stralloc_copyb(&uidstr,x,i)) die_nomem();
- if (!stralloc_0(&uidstr)) die_nomem();
- scan_ulong(uidstr.s,&uid);
- - ++i; x += i; xlen -= i; i = byte_chr(x,xlen,':'); if (i == xlen) return;
- + ++i; x += i; xlen -= i; i = byte_chr(x,xlen,'|'); if (i == xlen) return;
- if (!stralloc_copyb(&gidstr,x,i)) die_nomem();
- if (!stralloc_0(&gidstr)) die_nomem();
- - ++i; x += i; xlen -= i; i = byte_chr(x,xlen,':'); if (i == xlen) return;
- - ++i; x += i; xlen -= i; i = byte_chr(x,xlen,':'); if (i == xlen) return;
- + ++i; x += i; xlen -= i; i = byte_chr(x,xlen,'|'); if (i == xlen) return;
- + ++i; x += i; xlen -= i; i = byte_chr(x,xlen,'|'); if (i == xlen) return;
- if (!stralloc_copyb(&home,x,i)) die_nomem();
- if (!stralloc_0(&home)) die_nomem();
-
- @@ -165,10 +165,10 @@
- mailnames = user.s;
-
- for (;;) {
- - while (*mailnames == ':') ++mailnames;
- + while (*mailnames == '|') ++mailnames;
- if (!*mailnames) break;
-
- - i = str_chr(mailnames,':');
- + i = str_chr(mailnames,'|');
-
- if (substdio_puts(subfdout,"=") == -1) die_write();
- if (substdio_put(subfdout,mailnames,i) == -1) die_write();
- @@ -196,12 +196,12 @@
- unsigned int xlen;
- char *uugh;
-
- - x = line.s; xlen = line.len; i = byte_chr(x,xlen,':'); if (i == xlen) return;
- + x = line.s; xlen = line.len; i = byte_chr(x,xlen,'|'); if (i == xlen) return;
- if (!stralloc_copyb(&sub,x,i)) die_nomem();
- - ++i; x += i; xlen -= i; i = byte_chr(x,xlen,':'); if (i == xlen) return;
- + ++i; x += i; xlen -= i; i = byte_chr(x,xlen,'|'); if (i == xlen) return;
- uugh = constmap(&mapuser,x,i);
- if (!uugh) die_user(x,i);
- - ++i; x += i; xlen -= i; i = byte_chr(x,xlen,':'); if (i == xlen) return;
- + ++i; x += i; xlen -= i; i = byte_chr(x,xlen,'|'); if (i == xlen) return;
-
- if (substdio_puts(subfdout,"=") == -1) die_write();
- if (substdio_put(subfdout,sub.s,sub.len) == -1) die_write();
- diff -u --new-file ../qmail-1.01-unmodified/qmail-queue.c ./qmail-queue.c
- --- ../qmail-1.01-unmodified/qmail-queue.c Tue Apr 15 07:05:23 1997
- +++ ./qmail-queue.c Wed Sep 10 12:45:41 1997
- @@ -249,6 +249,15 @@
-
- if (link(intdfn,todofn) == -1) die(106);
-
- +#ifdef __amigaos__
- + /* Close files and force uid/gid to be set. */
- + close (messfd);
- + close (intdfd);
- + if (chown (todofn, auto_uidq, auto_gidq) == -1) die (105);
- + if (chown (intdfn, auto_uidq, auto_gidq) == -1) die (105);
- + if (chown (messfn, auto_uidq, auto_gidq) == -1) die (105);
- +#endif
- +
- triggerpull();
- die(0);
- }
- diff -u --new-file ../qmail-1.01-unmodified/qmail-send.c ./qmail-send.c
- --- ../qmail-1.01-unmodified/qmail-send.c Tue Apr 15 07:05:23 1997
- +++ ./qmail-send.c Thu Oct 2 08:49:29 1997
- @@ -32,6 +32,26 @@
- #include "fmtqfn.h"
- #include "readsubdir.h"
-
- +#ifdef __amigaos__
- +#define timeval amigaos_timeval
- +#include <exec/types.h>
- +#include <dos/dos.h>
- +#include <proto/exec.h>
- +#undef timeval
- +#include <sys/signal.h>
- +#include <stdio.h> /* Needed by ix(_amiga).h. */
- +/* Hack to find out if include files are for ixemul version 47+ or not. */
- +#define __pos__
- +#ifndef CTOBPTR
- +#define ix_select extselect
- +#include <ix_amiga.h>
- +#else
- +#define __INCLV47__
- +#include <ix.h>
- +#endif
- +#undef __pos__
- +#endif
- +
- /* critical timing feature #1: if not triggered, do not busy-loop */
- /* critical timing feature #2: if triggered, respond within fixed time */
- /* important timing feature: when triggered, respond instantly */
- @@ -1266,8 +1286,12 @@
- if (*wakeup > nexttodorun) *wakeup = nexttodorun;
- }
-
- +#ifndef __amigaos
- void todo_do(rfds)
- fd_set *rfds;
- +#else
- +void todo_do (unsigned long signals)
- +#endif
- {
- struct stat st;
- substdio ss; int fd;
- @@ -1293,7 +1317,11 @@
-
- if (!tododir)
- {
- +#ifndef __amigaos__
- if (!trigger_pulled(rfds))
- +#else
- + if (!trigger_pulled (signals))
- +#endif
- if (recent < nexttodorun)
- return;
- trigger_set();
- @@ -1553,6 +1581,10 @@
- int nfds;
- struct timeval tv;
- int c;
- +#ifdef __amigaos__
- + long signalmask;
- + int selret;
- +#endif
-
- if (chdir(auto_qmail) == -1)
- { log1("alert: cannot start: unable to switch to home directory\n"); _exit(111); }
- @@ -1560,6 +1592,13 @@
- { log1("alert: cannot start: unable to read controls\n"); _exit(111); }
- if (chdir("queue") == -1)
- { log1("alert: cannot start: unable to switch to queue directory\n"); _exit(111); }
- +#ifdef __amigaos__
- + /* Clear the signals we use before use. */
- + SetSignal (0UL, SIGBREAKF_CTRL_D | SIGBREAKF_CTRL_E | SIGBREAKF_CTRL_F);
- + /* Cause Ctrl-C (from e.g. the Break command) do terminate qmail.
- + * Ctrl-C is mapped to SIGINT by default, so map SIGINT to SIGTERM). */
- + signal (SIGINT, sigterm);
- +#endif
- sig_pipeignore();
- sig_termcatch(sigterm);
- sig_alarmcatch(sigalrm);
- @@ -1630,18 +1669,46 @@
- else tv.tv_sec = wakeup - recent + SLEEP_FUZZ;
- tv.tv_usec = 0;
-
- +#ifdef __amigaos__
- + signalmask = SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D |
- + SIGBREAKF_CTRL_E | SIGBREAKF_CTRL_F;
- + selret = ix_select (nfds, &rfds, &wfds, (fd_set *) 0UL, &tv, &signalmask);
- + if (selret == -1 && !(signalmask & SIGBREAKF_CTRL_D))
- +#else
- if (select(nfds,&rfds,&wfds,(fd_set *) 0,&tv) == -1)
- +#endif
- if (errno == error_intr)
- +#ifndef __amigaos__
- ;
- +#else
- + {
- + /* Map some Amiga signals to Un*x ones
- + (Ctrl-C is mapped to SIGINT elsewhere). */
- + if (signalmask & SIGBREAKF_CTRL_E) sigalrm ();
- + if (signalmask & SIGBREAKF_CTRL_F) sighup ();
- +#endif /* __amigaos__ */
- + }
- else
- log1("warning: trouble in select\n");
- else
- {
- recent = now();
-
- +#ifdef __amigaos__
- + if (selret == -1 && (signalmask & SIGBREAKF_CTRL_D))
- + {
- + /* This prevents qmail-send from hanging (but don't ask me why). */
- + FD_ZERO (&rfds);
- + FD_ZERO (&wfds);
- + }
- +#endif
- comm_do(&wfds);
- del_do(&rfds);
- +#ifdef __amigaos__
- + todo_do(signalmask);
- +#else
- todo_do(&rfds);
- +#endif
- pass_do();
- cleanup_do();
- }
- diff -u --new-file ../qmail-1.01-unmodified/qsutil.c ./qsutil.c
- --- ../qmail-1.01-unmodified/qsutil.c Tue Apr 15 07:05:23 1997
- +++ ./qsutil.c Thu Sep 25 23:48:34 1997
- @@ -2,6 +2,7 @@
- #include "readwrite.h"
- #include "substdio.h"
- #include "qsutil.h"
- +#include "error.h"
-
- static stralloc foo = {0};
-
- @@ -19,10 +20,16 @@
- substdio_putsflush(&sserr,s1);
- substdio_putsflush(&sserr,s2);
- substdio_putsflush(&sserr,s3); }
- +void log5(s1,s2,s3,s4,s5) char *s1; char *s2; char *s3; char *s4; char *s5; {
- + substdio_putsflush(&sserr,s1);
- + substdio_putsflush(&sserr,s2);
- + substdio_putsflush(&sserr,s3);
- + substdio_putsflush(&sserr,s4);
- + substdio_putsflush(&sserr,s5); }
- void nomem() { log1("alert: out of memory, sleeping...\n"); sleep(10); }
-
- void pausedir(dir) char *dir;
- -{ log3("alert: unable to opendir ",dir,", sleeping...\n"); sleep(10); }
- +{ log5("alert: unable to opendir ",dir," (",strerror(errno),"), sleeping...\n"); sleep(10); }
-
- static int issafe(ch) char ch;
- {
- diff -u --new-file ../qmail-1.01-unmodified/trigger.c ./trigger.c
- --- ../qmail-1.01-unmodified/trigger.c Tue Apr 15 07:05:23 1997
- +++ ./trigger.c Fri Sep 26 20:43:14 1997
- @@ -1,15 +1,19 @@
- #include "select.h"
- -#include "open.h"
- #include "trigger.h"
- +#ifndef __amigaos__
- +#include "open.h"
- #include "hasnpbg1.h"
- -
- static int fd = -1;
- #ifdef HASNAMEDPIPEBUG1
- static int fdw = -1;
- #endif
- +#else /* if __amigaos__ */
- +#include <dos/dos.h>
- +#endif /* __amigaos__ */
-
- void trigger_set()
- {
- +#ifndef __amigaos__
- if (fd != -1)
- close(fd);
- #ifdef HASNAMEDPIPEBUG1
- @@ -20,22 +24,35 @@
- #ifdef HASNAMEDPIPEBUG1
- fdw = open_write("lock/trigger");
- #endif
- +#endif /* ! __amigaos__ */
- }
-
- void trigger_selprep(nfds,rfds)
- int *nfds;
- fd_set *rfds;
- {
- +#ifndef __amigaos__
- if (fd != -1)
- {
- FD_SET(fd,rfds);
- if (*nfds < fd + 1) *nfds = fd + 1;
- }
- +#endif
- }
-
- +#ifndef __amigaos__
- int trigger_pulled(rfds)
- fd_set *rfds;
- {
- if (fd != -1) if (FD_ISSET(fd,rfds)) return 1;
- return 0;
- }
- +#else
- +int trigger_pulled (unsigned long signals)
- +{
- + if (signals & SIGBREAKF_CTRL_D)
- + return 1;
- + else
- + return 0;
- +}
- +#endif
- diff -u --new-file ../qmail-1.01-unmodified/triggerpull.c ./triggerpull.c
- --- ../qmail-1.01-unmodified/triggerpull.c Tue Apr 15 07:05:23 1997
- +++ ./triggerpull.c Fri Sep 26 20:33:07 1997
- @@ -1,9 +1,21 @@
- +#ifndef __amigaos__
- #include "ndelay.h"
- #include "open.h"
- +#else
- +#include <exec/types.h>
- +#include <exec/tasks.h>
- +#include <dos/dos.h>
- +#include <dos/dosextens.h>
- +#include <proto/exec.h>
- +#include <proto/dos.h>
- +#include <string.h>
- +#include <signal.h>
- +#endif /* __amigaos__ */
- #include "triggerpull.h"
-
- void triggerpull()
- {
- +#ifndef __amigaos__
- int fd;
-
- fd = open_write("lock/trigger");
- @@ -13,4 +25,30 @@
- write(fd,"",1); /* if it fails, bummer */
- close(fd);
- }
- +#else /* __amigaos__ */
- + /* This is the ugly part. */
- + ULONG maxCLI, i;
- + struct Process *proc;
- + struct CommandLineInterface *cli;
- + UBYTE *cmdName;
- + int omask;
- +
- + /* Disable Un*x signals. */
- + omask = sigsetmask (~0);
- + /* Forbid preemptive task switching. :-( */
- + Forbid ();
- + maxCLI = MaxCli ();
- + /* Send a Ctrl-D signal to all processes named "qmail-send". */
- + for (i = 1UL; i <= maxCLI; i++)
- + if ((proc = FindCliProc (i)))
- + if ((cli = BADDR (proc->pr_CLI)))
- + if ((cmdName = BADDR (cli->cli_CommandName)))
- + if (cmdName[0] > 0 && 0 == strncmp ("qmail-send", &cmdName[1], cmdName[0]))
- + {
- + Signal ((struct Task *) proc, SIGBREAKF_CTRL_D);
- + }
- +
- + Permit ();
- + sigsetmask (omask);
- +#endif /* __amigaos__ */
- }
-